import { HEAD_DATA } from '../actions/actionTypes';

const initState = {
  items: []
};

const categoryReducer = (state = initState, action) => {
  switch (action.type) {
    case HEAD_DATA:
      return getCategory(state, action);
    default:
      return state;
  }
}

const getCategory = (state, action) => {
  return { ...state, items: action.obj.data.primary_filter };
}

export default categoryReducer;